/**
 * @author LKQ
 * @date 2021/12/24 17:48
 * @description 循环
 */
public class Solution {
    public static void main(String[] args) {
        Solution solution = new Solution();
        System.out.println(solution.isPowerOfTwo(4));
    }

    public boolean isPowerOfTwo(int n) {
        if (n <= 0 ) {
            return false;
        }else {
            while (n % 2 == 0) {
                n /= 2;
            }
            if (n == 1) {
                return true;
            } else {
                return false;
            }
        }
    }
}
